<template>
  <ul class="center">
    <!-- <CartItem v-for="good in $store.state.list" :good="good" :key="good.id" /> -->
    
    <!-- 简写 -->
    <CartItem v-for="good in list" :good="good" :key="good.id" />
    
  </ul>
</template>

<script>
  import { mapState } from "vuex";
import CartItem from "./CartItem.vue";
export default {
  name: "CartList",
  computed:{
    ...mapState(['list']),
  },
  components: {
    CartItem,
  },
};
</script>

<style>
.center {
  width: 100%;
}
</style>
